package NC56_回文数字;

import java.util.*;


public class Solution {
    /**
     *
     * @param x int整型
     * @return bool布尔型
     */
    public boolean isPalindrome (int x) {
        // write code here
        if (x < 0){
            return false;
        }
        int div = 1;
        while (x / div >= 10){
            div *= 10;
        }

        while (x > 0){
            int left = x / div;
            int right = x % 10;

            if (right != left){
                return false;
            }

            x = (x % div) / 10;
            div /= 100;
        }
        return true;
    }
}